# -*- coding: utf-8 -*-

"""
有如下一个字符串变量logs，请统计出每种请求类型的数量（提示：空格分割的第2列是请求类型），得到如下输出：
POST 2
GET 3
"""


logs = '''
111.30.144.7 "POST /mock/login/?t=GET HTTP/1.1" 200 
111.30.144.7 "Get /mock/users/?t=POST HTTP/1.1" 200 
111.13.100.92 "Post /mock/login/ HTTP/1.1" 200 
223.88.60.88 "GET /mock/users/?t=POST HTTP/1.1" 200 
111.30.144.7 "GET /mock/users/ HTTP/1.1" 200 
'''


# 方法一
print("""
#方法一: """)
posts01 = logs.upper().count('"POST')
gets01 = logs.upper().count('"GET')
print('POST {}'.format(posts01))
print('GET {}'.format(gets01))


# 方法二
print("""
#方法二: """)
posts02 = logs.upper().replace('=POST', '').count('POST')
gets02 = logs.upper().replace('=GET', '').count('GET')
print('POST {}'.format(posts02))
print('GET {}'.format(gets02))



# 方法三
print("""
#方法三: """)
posts03 = logs.upper().split(" ").count('"POST')
gets03 = logs.upper().split(" ").count('"GET')
print('POST {}'.format(posts03))
print('GET {}'.format(gets03))